$(document).ready(function(){
	$("#data-form").striped();	
	$("#data-form").validate();
	$("#add-article").click(function(){
		$("#content").val( $(".nicEdit-main").html() );
		$("#data-form").submit();
	});
	
	$("#select-service").click(function(){
		$("#service-dialog").dialog({
			modal: true,
			width: 600,
			height:400,
			buttons: { 
				"确定": function() { 
					var value_array = new Array();
					var name_array = new Array();
					var selected_obj = $("input[name='service_id']");
					$.each( selected_obj, function(i, n){
						if( $(n).attr("checked")) {
							value_array.push( $(n).attr("value") );
							name_array.push( $(n).attr("title") );	
						}	
					});
					$("#service_list").html( name_array.join(",") );
					$("#service_id_string").attr( "value", value_array.join(",") );
					$(this).dialog("close"); 
				}, 
				"取消": function() {
					$(this).dialog("close"); 
				}
			}
		});
	});

});

/** 在线编辑器 **/
bkLib.onDomLoaded(function() { 
	new nicEditor({
		fullPanel : true
	}).panelInstance('content');
});	
